﻿package com.sshc625.events {
	import flash.events.Event;

	/**
	 * @author sshc625
	 */
	public class ServiceEvent extends Event {
		/**
		 * Events
		 */
		public static const FAULT:String = "fault";
		public static const RESULT:String = "result";

		/**
		 * Public properties
		 */
		public var errorCode:String;
		public var result:*;

		/**
		 * Constructor
		 *
		 */
		public function ServiceEvent( type:String, bubbles:Boolean = false, cancelable:Boolean = false ) {
			super( type, bubbles, cancelable );
		}

		/**
		 * Make an exact copy of the ServiceEvent
		 * @return      Exact copy
		 *
		 */
		override public function clone():Event {
			var evt:ServiceEvent = new ServiceEvent( this.type, this.bubbles, this.cancelable );
			evt.result = this.result;
			evt.errorCode = this.errorCode;

			return evt;
		}

		/**
		 * Returns the string representation of the ServiceEvent
		 * @return      String representation of the ServiceEvent
		 *
		 */
		override public function toString():String {
			return "[ServiceEvent " + "type='" + this.type + "' " + "result='" + this.result + "' " + "errorCode='" + this.errorCode + "' " + "]";
		}
	}
}